library(R.matlab)
## R.matlab v3.6.2 (2018-09-26) successfully loaded. See ?R.matlab for help.
## 
## Attaching package: 'R.matlab'
## The following objects are masked from 'package:base':
## 
##     getOption, isOpen
source("ada_threshold_3d.R")

True label

volume <- readMat('sample.mat')$vol
label  <- readMat('true_label.mat')$md
label[label!=0] = 1
true_plot <- which(label==1, arr.ind = TRUE)
plot3d(true_plot, col = rgb(0,0,1,0.2))

You must enable Javascript to view this page properly.

Adaptive-thresholding

ada <- ada_threshold_3d(volume)
ada_plot <- which(ada==1, arr.ind = TRUE)
plot3d(ada_plot, col = rgb(0,0,1,0.2))

You must enable Javascript to view this page properly.

TP <- sum(label==1&ada==1)/sum(label==1)
FN <- 1-TP
TN <- sum(label==0&ada==0)/sum(label==0)
FP <- 1-TN
c(TP=TP,FN=FN,TN=TN,FP=FP)
##        TP        FN        TN        FP 
## 0.3971686 0.6028314 0.8559135 0.1440865